/* 管理事务和访问者的抽象类 */
#pragma once

#include <list>

#include "AbstractInterviewee.h"
#include "AbstractVisitor.h"

// 购物车类
class ShoppingCart {
public:
    void accept(Visitor* visitor) {
        for (auto product : productList_) {
            product->accept(visitor);
        }
    }

    void addProduct(Product* product) { productList_.push_back(product); }

    void removeProduct(Product* product) { productList_.remove(product); }

private:
    std::list<Product*> productList_;
};